package me.muci.thread02_executor;

import org.junit.Test;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * ClassName: FixedThreadPoolTest
 * Description: 所有任务只能使用固定大小的线程
 * date: 2022/2/23 9:32
 *
 * @author muci
 * @since JDK 1.8
 */
public class FixedThreadPoolTest {
    @Test
    public void test() throws InterruptedException {
        ExecutorService executorService = Executors.newFixedThreadPool(5);
        for (int i = 0; i < 10; i++) {
            executorService.execute(new MyRunnable());
        }
        executorService.shutdown();
    }
}
